//
//  YDOptionalEditingTableHeaderView.m
//  PeiZiWangBei
//
//  Created by LK-IOS on 2017/11/14.
//  Copyright © 2017年 LK-IOS. All rights reserved.
//

#import "YDOptionalEditingTableHeaderView.h"

@interface YDOptionalEditingTableHeaderView()
//分割线
@property (nonatomic , weak) UIView *lineView;
//股票名称
@property (nonatomic , weak) UILabel *stockName;
//置顶
@property (nonatomic , weak) UILabel *zhiding;
@end



@implementation YDOptionalEditingTableHeaderView


+ (instancetype)headerViewWithTableView:(UITableView *)tableView
{
    
    static NSString *optionalEditingTableHeaderView = @"YDOptionalEditingTableHeaderView";
    YDOptionalEditingTableHeaderView *headerView = [tableView dequeueReusableHeaderFooterViewWithIdentifier:optionalEditingTableHeaderView];
    if (headerView == nil) {
        headerView = [[YDOptionalEditingTableHeaderView alloc] initWithReuseIdentifier:optionalEditingTableHeaderView];
    }
    return headerView;
}


-(instancetype)initWithReuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithReuseIdentifier:reuseIdentifier];
    if (self) {
        
        self.contentView.backgroundColor = [UIColor whiteColor];
        [self lineView];
        
        [self stockName];
        [self zhiding];
        
    }
    return self;
}

-(UIView *)lineView
{
    if (_lineView == nil) {
        UIView *lineView = [[UIView alloc] init];
        [self.contentView addSubview:lineView];
        lineView.backgroundColor = NumberColor(247, 247, 247);
        [lineView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.right.bottom.equalTo(self);
            make.height.equalTo(@1);
        }];
        
        _lineView = lineView;
    }
    return _lineView;
}
-(UILabel *)stockName
{
    if (_stockName == nil) {
        UILabel *stockName = [[UILabel alloc] init];
        [self.contentView addSubview:stockName];
        stockName.textColor = [UIColor colorWithHexString:blueyGrey];
        stockName.textAlignment  = NSTextAlignmentLeft;
        stockName.font = [UIFont systemFontOfSize:font12ScreenWRate * LKScreenW];
        stockName.text = @"股票名称";
        [stockName mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self).offset(rate375(22));
            make.centerY.equalTo(self);
        }];
        _stockName = stockName;
    }
    return _stockName;
}

-(UILabel *)zhiding
{
    if (_zhiding == nil) {
        UILabel *zhiding = [[UILabel alloc] init];
        [self.contentView addSubview:zhiding];
        zhiding.textColor = [UIColor colorWithHexString:blueyGrey];
        zhiding.textAlignment  = NSTextAlignmentRight;
        zhiding.font = [UIFont systemFontOfSize:font12ScreenWRate * LKScreenW];
        zhiding.text = @"置顶";
        [zhiding mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(self).offset(-rate375(39));
            make.centerY.equalTo(self);
        }];
        _zhiding = zhiding;
    }
    return _zhiding;
}

@end
